<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>
    <canvas id="canvas" width="500" height="500" style="border:1px solid #000"></canvas>
</body>
</html>             

<script type="text/javascript">
	var canvas = document.getElementById('canvas');
	var context = canvas.getContext('2d');
	context.fillStyle='#eeeeef';
	context.fillRect(0,0,500,500);
	var dx =150;
	var dy =150;
	var s =100;
	context.beginPath();
	context.fillStyle = 'rgb(100,255,100)';
	context.strokeStyle="rgb(0,0,100)";
	var x = Math.sin(0);
	var y = Math.cos(0);
	var dig =Math.PI/15*11;
 // (正六边形）var dig =2*Math.PI/6*11;
 //  var i =0; i < 6;i++



    //五角星var dig =2*Math.PI/5*2;
	//for (var i =0; i <5 ;i++)

	for (var i =0; i < 30;i++) {
		var x =Math.sin(i*dig);
		var y =Math.cos(i*dig);
		context.lineTo(dx+s*x,dy+s*y);
	}
    context.closePath();
    context.fill();
    context.stroke();


</script>